import 'package:enterprise_v6_app/app/components/custom_app_bar.dart';
import 'package:enterprise_v6_app/app/components/special_operation/custom_file_upload_page.dart';
import 'package:enterprise_v6_app/app/components/special_operation/custom_high_input_page.dart';
import 'package:enterprise_v6_app/app/components/special_operation/custom_picker_photo.dart';
import 'package:enterprise_v6_app/app/components/special_operation/custom_select_button_page.dart';
import 'package:enterprise_v6_app/app/core/core.dart';
import 'package:enterprise_v6_app/app/core/ext/ext.dart';
import 'package:enterprise_v6_app/app/data/common/simple_choice_bean.dart';
import 'package:enterprise_v6_app/app/modules/alarm_management/detail/disposal_page/disposal_page_controller.dart';

/// 报警处置页面
class DisposalPagePage extends StatelessWidget {
  DisposalPagePage({super.key});

  final controller = Get.put(DisposalPageController());

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: CustomAppBar(
        titleText: '报警处置',
      ),
      body: _buildDisposeItem(),
      bottomSheet: Container(
        height: 48.w,
        width: AppDimens.sw,
        color: AppColors.blue_button,
        alignment: Alignment.center,
        child: Text('提交',style: TextStyle(
          fontSize: 16.sp,
          color: Colors.white,
        )),
      ).clickOnce(controller.disposeAlarmRecord),
    );
  }

  // 处置任务选项
  Widget _buildDisposeItem() {
    return Container(
      padding: EdgeInsets.symmetric(horizontal: 16.w),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Row(
            children: [
              Text(
                '处置方式：',
                style: TextStyle(fontSize: 14.sp, height: 1.2, color: const Color(0xFF262F38), fontWeight: FontWeight.w400),
              ),
              Expanded(
                child: CustomSelectButtonPage<SimpleChoiceBean>(
                  wrapAlignment: WrapAlignment.end,
                  dataList: controller.choiceDataList,
                  onConfirm: (List<SimpleChoiceBean> value) {
                    if (value.isNotEmpty) {
                      controller.switchStates(value[0]);
                    }
                  },
                ),
              ),
            ],
          ),
          CustomPickerPhoto(
            title: '消警措施:',
            maxCount: 9,
            imagesList: controller.disPhotos,
            titleTextStyle: TextStyle(
              fontSize: 14.sp,
              height: 1.2,
              fontWeight: FontWeight.w500,
              color: const Color(0xff262F38),
            ),
          ),
          CustomHighInputPage(
            title: '消警描述：',
            isRequired: true,
            text: controller.disDesc,
            hintText: '请输入消警描述',
            onCallBack: (value) {
              controller.disDesc = value;
            },
          ),
          CustomFileUploadPage(
            title: '附件：',
            isRequired: false,
            isEnabled: true,
            uploadedFiles: controller.uploadedFiles,
            onCallBack: (value) {
              controller.uploadedFiles = value;
            },
          ),

        ],
      ),
    );
  }



}
